﻿//上传图片标题的UE编辑器，只有上传图片功能 ，注意：并不是很完善
var uploadEditor = UE.getEditor("uploadEditor", {
    isShow: false,
    focus: false,
    enableAutoSave: false,
    autoSyncData: false,
    autoFloatEnabled: false,
    wordCount: false,
    sourceEditor: null,
    scaleEnabled: true,
    toolbars: [["insertimage"]]
});
//绑定上图片按钮的单击事件，单击事件弹出上传图片标题的UE编辑器
document.getElementById('j_upload_img_btn').onclick = function () {
    var dialog = uploadEditor.getDialog("insertimage");
    dialog.title = '上传图片';
    dialog.render();
    dialog.open();
};

// 监听多图上传和上传附件组件的插入动作
uploadEditor.ready(function () {
    uploadEditor.addListener("beforeInsertImage", _beforeInsertImage);
});

// 多图上传动作
function _beforeInsertImage(t, result) {
    var imageHtml = result[0].src;
    //for (var i in result) {
    //    imageHtml += '<li><img src="' + result[i].src + '" alt="' + result[i].alt + '" height="150"></li>';
    //}
    document.getElementById('PicTitle').value = imageHtml;
}